package main

import (
	"fmt"
	"strconv"
)

func main() {
	name := "hcj"
	age := 24
	fmt.Println("name" + name + ",age " + strconv.Itoa(age))
	fmt.Printf("name%v,age%v\n", name, age)
	fmt.Printf("name%#v,age%#v\n", name, age)
	fmt.Printf("name:%T,age:%T\n", name, age)
	fmt.Printf("name %s,age %d\n", name, age)
	fmt.Printf("name %s,age %-4d,\n", name, age)
	fmt.Printf("name %s,age %b\n", name, age) //数字显示成2进制
	fmt.Printf("name %s,age %o\n", name, age) //数字显示成8进制
	fmt.Printf("name %s,age %x\n", name, age) //数字显示成16进制
	desc := fmt.Sprintf("name %s,age %x\n", name, age)
	fmt.Printf(desc)

	data := 65
	fmt.Printf("%c\n", data)
	fmt.Printf("%q\n", data)

	fmt.Printf("%f\n", 65.1)
	fmt.Printf("%e\n", 65.1)

	//输入
	//var name1 string
	//_, err := fmt.Scanln(&name1)
	//if err != nil {
	//	return
	//}
	//fmt.Println(name1)

	var n string
	var age1 int
	fmt.Println("请输入名字和年龄")
	_, err := fmt.Scanf("%s %d", &n, &age1)
	if err != nil {
		return
	}
	fmt.Println(n, age1)

}
